Skip to content

fix(codex): 429-transient refresh, drop broken quota fallback, uniform PKCE, bounded push#122

Merged
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
fix/codex-reliability-round2
Jul 7, 2026
Merged

fix(codex): 429-transient refresh, drop broken quota fallback, uniform PKCE, bounded push#122
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
fix/codex-reliability-round2

Conversation

@aayambansal

Copy link
Copy Markdown
Member

Codex reliability round 2 (from the audit):

Tests

Added a 429-is-retried case to codex-refresh.test.ts; existing refresh/device-poll/401-retry tests still pass (24 plugin tests green).

…k, harden PKCE + push

- refreshAccessToken no longer treats a 429/408 on the token endpoint as a
  fatal 'sign-in expired'. During a retry storm auth.openai.com rate-limits
  the token endpoint; the whole 4xx range was fatal, forcing a needless full
  re-auth. Retry 429/408 (and 5xx) with backoff; only a genuine 4xx reconnects. (#19)
- Removed the shared-key quota fallback. On 429/403 it forwarded the
  ChatGPT-internal Codex model id + Codex-shaped body to api.openai.com
  (which doesn't know those models → 400s) under process.env.OPENAI_API_KEY,
  and the substring quota-match could misfire on unrelated 403s → silently
  charging the user's personal key. Return the 429/403 as-is instead. (#15)
- generateRandomString uses rejection sampling for a uniform PKCE verifier
  (b % 66 biased toward the first 58 chars). (#45)
- pushTokensToBackend fetch is bounded by OAUTH_HTTP_TIMEOUT_MS so a hung
  backend can't leave 'keys signin' spinning after the browser succeeded. (#35)
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openscience Ready Ready Preview, Comment Jul 7, 2026 3:33am

Request Review

@aayambansal Aayam Bansal (aayambansal) merged commit a977b71 into main Jul 7, 2026
12 checks passed
@aayambansal Aayam Bansal (aayambansal) deleted the fix/codex-reliability-round2 branch July 7, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant